<!DOCTYPE html>  
<html>  
  <head>  
    <title>For Loop</title>  
  </head>
  <body>  
    <script type="text/javascript">  
       for (i = 0; i < 10; i++) {
         if (i == 4) {
           break;
         }
         document.write(i);document.write("<br>");
       }
       document.write("<hr>");

       for (i = 0; i < 10; i++) {
         if (i == 4) {
           continue;
         }
         document.write(i);document.write("<br>");
       }
       document.write("<hr>");

       var i = 0;
       while (i < 10) {
         document.write(i);document.write("<br>");
         i++;
         if (i == 4) {
           break;
         }
       }
       document.write("<hr>");
       
       i = 0;
       while (i < 10) {
         if (i == 4) {
           i++;
           continue;
         }
         document.write(i);document.write("<br>");
         i++;
       }
       document.write("<hr>");
    </script> 
  </body>  
</html>